Skip to content

add --unstaged option to view only unstaged files/hunks#521

Open
githendrik wants to merge 1 commit intobacknotprop:mainfrom
githendrik:main
Open

add --unstaged option to view only unstaged files/hunks#521
githendrik wants to merge 1 commit intobacknotprop:mainfrom
githendrik:main

Conversation

@githendrik
Copy link
Copy Markdown

Related to this issue: #287
My personal flow is to stage hunks that I approved in previous steps. This flag allows me to view only the most recent changes.

} else {
// --- Local Review Mode ---
gitContext = await getVcsContext();
initialDiffType = gitContext.vcsType === "p4" ? "p4-default" : "uncommitted";
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have P4 users. I need to make sure this doesn't break for them.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, okay. I wasn't aware of this case. Do you need me to change something? Just let me know.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caveat, i havent fully reviewed...

deleted: gitContext.vcsType === "p4" ? "p4-default"

You might still need a ternary path to make this assignment is my concern.

I can validate later today and trace myself, and if I see a fix, I'll fix it. Otherwise, I think you just need to have a bit more verbose ternary that includes your new option but also the P4 default if that's set as vcsType.

@backnotprop
Copy link
Copy Markdown
Owner

backnotprop commented Apr 10, 2026

Hey Hendrik, thanks for this PR! Your workflow of staging approved hunks and reviewing only what's left is a great pattern.

I ended up going a slightly different direction with this. Instead of a CLI flag, I made the default diff type a persistent user setting (configurable in Settings > Display, stored in config.json). I also added a first-run dialog that prompts users to pick their preferred default the first time they open a local review. And I changed the hardcoded default from "uncommitted" to "unstaged" to match git diff semantics, which aligns with what you were going for.

You have co-authorship on the commit in #531 since your PR is what kicked this off. Appreciate you taking the time to contribute.

backnotprop added a commit that referenced this pull request Apr 10, 2026
feat(review): configurable default diff type with first-run setup

Add `defaultDiffType` as a persistent user setting (cookie + config.json) with 'unstaged' as the default, matching `git diff` semantics. A first-run setup dialog prompts users to choose their preferred default on first review session. The setting is also available in Settings > Display.

Entry points (hook, opencode, pi-extension) read the config via `resolveDefaultDiffType()` instead of hardcoding. The setup dialog applies the chosen diff type to the active review immediately. P4 users are excluded from the Git-specific dialog.

Based on the community contribution in #521 by Hendrik Richert.

Co-authored-by: Hendrik Richert <hendrik.richert@swisscom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants